#pragma once

#include <QtGui/QTextDocument>
#include <boostext/util/make_shared.hpp>

#include "StyleDocument.hpp"




class Document
{
public:

	SHARED(Document);

public:

	Document();
	Document(const QString& fileName);

	/**
	 * Get the filename of this document.
	 */
	QString fileName() const;

	/**
	* Although StyleDefinition already implements the load function, we have to overwrite it.
	* StyleDefinition is expecting a working css definition that can be used to render something,
	* but the StyleDocument class is meant to be edited, so it must be able to hold an incorrect
	* css definition that may be fixed by the user.
	*/
	void load(QString fileName);
	void save();
	void save(QString fileName);



	/**
	 * Get access to the style document.
	 */
	StyleDocument& styleDocument();

	/**
	 * Get access to the style document.
	 */
	const StyleDocument& styleDocument() const;



	/**
	 * Get access to the css document.
	 */
	QTextDocument* cssDocument();

	/**
	 * Get access to the css document.
	 */
	const QTextDocument* cssDocument() const;

private:

	QString         m_fileName;
	StyleDocument   m_styleDocument;
	QTextDocument   m_cssDocument;
};
///////////////////////////////////////////////////////////////////////////////////////////////////
